//
//  WellCome.m
//  Wallet
//
//  Created by 贺庆博 on 2018/6/21.
//  Copyright © 2018年 ebo. All rights reserved.
//

#import "WellCome.h"

@implementation WellCome

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self initSubViews];
    }
    return self;
}
- (void)initSubViews
{
    UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:self.frame];
    scrollView.bounces = NO;
    scrollView.pagingEnabled = YES;
    [scrollView setShowsVerticalScrollIndicator:NO];
    [scrollView setShowsHorizontalScrollIndicator:NO];
    [self addSubview:scrollView];
    NSArray *arr = @[@"screen_1",@"screen_2",@"screen_3",@"screen_4"];
    for (int i = 0; i <arr.count; i++) {
        UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(i*kScreenWidth, 0, scrollView.yzWidth, scrollView.yzHeight)];
        imgView.image = [UIImage imageNamed:arr[i]];
        [scrollView addSubview:imgView];
        if (i == arr.count - 1) {
            UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(taoAction)];
            imgView.userInteractionEnabled = YES;
            [imgView addGestureRecognizer:tap];
        }
    }
    scrollView.contentSize = CGSizeMake(kScreenWidth * arr.count, scrollView.yzHeight);
}

- (void)taoAction
{
    [self removeFromSuperview];
}
@end
